﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using Utils;
using AlipayClass;

public partial class order_alipay_pay : FBasePage
{


    // Methods
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (base.ASSystem != null)
        {
            string alipaymid = base.ASSystem.alipaymid;
            string alipaysec = base.ASSystem.Alipaysec;
            string alipayacc = base.ASSystem.alipayacc;
            string str4 = "utf-8";
            string str5 = base.WWWprefix + "order/alipay/notify.aspx";
            string str6 = base.WWWprefix + "order/alipay/returnurl.aspx";
            string str7 = "";
            string str8 = "MD5";
            NameValueCollection system = new SystemConfig().GetSystem();
            string str9 = "0";
            if (system["alipay_anti_phishing"] == "1")
            {
                str9 = "1";
            }
            string payid = base.Request.Form["out_trade_no"].ToString();
            string subject = base.Request.Form["subject"].ToString();
            string body = base.Request.Form["body"].ToString();
            string str13 = base.Request.Form["total_fee"];
            if (Maticsoft.BLL.Order.GetPayType(payid))
            {
                str13 = Maticsoft.BLL.Order.GetPayPrice(payid).ToString();
            }
            string paymethod = "bankPay";
            string defaultbank = "CMB";
            string str16 = "";
            string userHostAddress = "";
            if (str9 == "1")
            {
                str16 = AlipayFunction.Query_timestamp(alipaymid);
                userHostAddress = base.Request.UserHostAddress;
            }
            string str18 = "";
            string str19 = "";
            string str20 = "";
            string str21 = "";
            string str22 = "";
            string url = string.Empty;
            if (system["alipay_SecuredTransactions"] != "1")
            {
                url = new AlipayService(alipaymid, alipayacc, str6, str5, str7, payid, subject, body, str13, paymethod, defaultbank, str16, userHostAddress, str18, str19, str20, str21, str22, alipaysec, str4, str8).Create_url();
            }
            else
            {
                url = new AlipaySecuredTransactionsService(alipaymid, alipayacc, str6, str5, str7, payid, subject, body, str13, "0", "EXPRESS", "SELLER_PAY", "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, alipaysec, str4, str8).Create_url();
            }
            base.Response.Redirect(url);
        }
    }

}